body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    color: #333;
    background-color: #f9f9f9;
}

/* Sidebar styles */
.dashboard-layout {
    display: flex;
}

.sidebar {
    width: 250px;
    background-color: #2f3e46;
    color: #fff;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    padding-top: 20px;
    transition: all 0.3s ease;
    z-index: 1000;
}

.sidebar.collapsed {
    width: 60px;
}

.sidebar.collapsed .nav-link {
    padding: 12px 15px;
    text-align: center;
}

.sidebar.collapsed .nav-link::before {
    content: "";
    display: none;
}

.sidebar.collapsed .nav-link span {
    display: none;
}

.sidebar.collapsed .sidebar-nav ul ul {
    display: none !important;
}

.toggle-btn {
    position: absolute;
    bottom: 20px;
    left: 15px;
    background: #52b788;
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.sidebar.collapsed .toggle-btn {
    left: 50%;
    transform: translateX(-50%);
    padding: 8px;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav li {
    margin-bottom: 6px;
    position: relative;
}

.nav-link {
    display: block;
    padding: 12px 20px 12px 35px;
    color: #fff;
    text-decoration: none;
    font-size: 16px;
    transition: all 0.3s;
    position: relative;
}

/* 主菜单项动态缩进 */
.sidebar-nav > ul > li > .nav-link {
    padding-left: 35px;
    position: relative;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
}

/* 折叠状态下主菜单样式 */
.sidebar.collapsed .sidebar-nav > ul > li > .nav-link {
    padding: 12px;
    justify-content: center;
}

@font-face {
  font-family: 'Font Awesome 5 Free';
  font-style: normal;
  font-weight: 900;
  font-display: block;
  src: url("../webfonts/fa-solid-900.woff2") format("woff2"),
       url("../webfonts/fa-solid-900.ttf") format("truetype");
}

/* 智能缩进导航系统 */
.sidebar-nav > ul > li > .nav-link {
    padding-left: 40px;
    position: relative;
    transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-nav > ul > li > .nav-link::before {
    content: "▶";
    left: 20px;
    font-size: 14px;
    width: 16px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 二级菜单 */
.sidebar-nav ul ul .nav-link {
    padding-left: 55px;
}

.sidebar-nav ul ul .nav-link::before {
    content: "▸";
    left: 35px;
    font-size: 13px;
}

/* 三级菜单 */
.sidebar-nav ul ul ul .nav-link {
    padding-left: 70px;
}

.sidebar-nav ul ul ul .nav-link::before {
    content: "•";
    left: 50px;
    font-size: 12px;
}

/* 动态布局保护 */
.dashboard-container {
    margin-left: 260px;
    width: calc(100% - 260px);
    transition: margin 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 动态布局保护 */
.dashboard-container {
    margin-left: 260px;
    width: calc(100% - 260px);
    transition: margin 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 精确层级指示 */
.sidebar-nav ul ul {
    border-left: 1px solid rgba(255,255,255,0.1);
    margin-left: 15px;
    padding-left: 10px;
}

.sidebar-nav ul ul ul {
    border-left-style: dashed;
    margin-left: 10px;
}

/* 折叠状态优化 */
.sidebar.collapsed .nav-link::before {
    content: "≡";
    font-size: 18px;
    left: 50%;
    transform: translateX(-50%);
}

.sidebar.collapsed .nav-link {
    padding: 15px !important;
}

/* 统一图标动画 */
.sidebar-nav .nav-link::before {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

/* 统一图标样式 */
.nav-link::before {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 激活状态图标动画 */
.nav-link.active::before {
    transform: translateY(-50%) rotate(90deg);
}

/* 折叠状态 */
.sidebar.collapsed {
    width: 60px;
    overflow: hidden;
}

.sidebar.collapsed .nav-link {
    padding: 15px !important;
    justify-content: center;
}

.sidebar.collapsed .nav-link::before {
    content: "▸";
    position: static;
    font-size: 20px;
    left: auto;
    transform: none;
    margin: 0;
}

/* 智能缩进系统 */
.sidebar-nav ul ul {
    padding-left: 25px !important;
    margin-left: 15px;
    border-left: 2px solid rgba(255,255,255,0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-nav ul ul ul {
    border-left-style: dashed;
    margin-left: 10px;
    padding-left: 20px;
}

/* 严格隐藏折叠状态的子菜单 */
.sidebar.collapsed .sidebar-nav ul ul {
    display: none !important;
}

/* 内容区域过渡 */
.dashboard-container {
    margin-left: 260px;
    width: calc(100% - 260px);
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 折叠状态优化 */
.sidebar.collapsed {
    width: 60px;
    overflow: hidden;
}

.sidebar.collapsed .nav-link {
    padding: 15px !important;
    justify-content: center;
}

.sidebar.collapsed .nav-link::before {
    content: "•";
    position: static;
    font-size: 24px;
    color: #52b788;
    margin: 0;
    transform: none;
}

.sidebar.collapsed .nav-link span {
    display: none;
}

/* 保持子菜单缩进结构 */
.sidebar-nav ul ul {
    padding-left: 20px !important;
}

/* 子菜单层级缩进 */
.sidebar-nav ul ul .nav-link {
    padding-left: 50px;
}

.sidebar-nav ul ul ul .nav-link {
    padding-left: 65px;
}

/* 折叠状态下的样式 */
.sidebar.collapsed .sidebar-nav > ul > li > .nav-link {
    padding: 12px 15px;
    text-align: center;
}

.sidebar.collapsed .sidebar-nav > ul > li > .nav-link::before {
    display: block;
    position: static;
    transform: none;
    margin: 0 auto;
}

.sidebar.collapsed .nav-link span {
    display: none;
}

.sidebar-nav ul ul .nav-link {
    padding-left: 50px;
}

.sidebar-nav ul ul ul .nav-link {
    padding-left: 65px;
}

/* 保持布局 */
.dashboard-container {
    margin-left: 260px;
    width: calc(100% - 260px);
    transition: margin 0.3s ease;
}

/* 图标样式 */
.nav-link::before {
    content: "▸";
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #52b788;
    transition: transform 0.2s;
}

/* 激活状态图标旋转 */
.nav-link.active::before {
    transform: translateY(-50%) rotate(90deg);
}

/* 子菜单交互样式 */
.sidebar-nav ul ul {
    position: relative;
    display: none;
    padding-left: 15px;
    overflow: hidden;
    transition: height 0.3s ease;
}

.sidebar-nav ul ul.show {
    display: block;
    animation: slideDown 0.3s ease;
}

.sidebar-nav ul ul::before {
    content: "";
    position: absolute;
    left: 30px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(255,255,255,0.1);
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.has-submenu > a {
    position: relative;
    padding-right: 35px !important;
}

.has-submenu > a::after {
    content: "▸";
    position: absolute;
    right: 15px;
    transition: transform 0.3s;
}

.has-submenu > a.active::after {
    transform: rotate(90deg);
}

.nav-link:hover,
.nav-link.active {
    background-color: #52b788;
    border-radius: 6px;
}

/* Updated main content styles */
.dashboard-container {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    padding: 30px;
    margin-top: 20px;
    margin-left: 260px; /* Space for sidebar */
    width: calc(100% - 260px);
    max-width: 1200px;
}

@media (max-width: 992px) {
    .dashboard-container {
        margin-left: 0;
        width: 100%;
    }
    
    .sidebar {
        display: none;
    }
}

/* Adjusted dashboard header position */
.dashboard-header {
    margin-left: 260px; /* Maintain content alignment */
    padding-top: 15px; /* Reduced top spacing */
}

@media (max-width: 992px) {
    .dashboard-header {
        margin-left: 0;
        padding-top: 12px; /* Responsive adjustment */
    }
}

.dashboard-header h1 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 24px;
    line-height: 1.2;
    color: #333;
    text-align: left;
    max-width: calc(100% - 260px); /* Match content width */
}

@media (max-width: 992px) {
    .dashboard-header {
        margin-left: 0; /* Full width on mobile */
    }
    
    .dashboard-header h1 {
        max-width: 100%; /* Full width on mobile */
        font-size: 22px; /* Slightly smaller on mobile */
    }
}

@media (max-width: 992px) {
    .dashboard-header {
        margin-left: 15px; /* Mobile spacing */
    }
    
    .dashboard-header h1 {
        font-size: 22px; /* Slightly smaller on mobile */
    }
}

/* Unified form layout */
.form-container {
    margin-left: 260px;
    padding-top: 20px;
}

/* Optimized form section styling */
.form-section {
    margin-left: 260px;
    margin-bottom: 25px;
}

.form-section:last-child {
    margin-bottom: 0;
}

/* Fixed stock type alignment */
.stock-inputs .form-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
}

.stock-inputs .form-group label {
    margin-bottom: 8px;
    order: 1; /* Ensure label comes first */
}

.stock-inputs .form-group select,
.stock-inputs .form-group input[type="text"] {
    width: 100%;
    max-width: 450px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    line-height: 1.5;
    order: 2; /* Ensure input comes after label */
}

@media (max-width: 768px) {
    .stock-inputs .form-group {
        width: 100%;
    }
}

/* Refined two-column layout */
.stock-inputs {
    display: flex;
    align-items: stretch; /* Ensure equal height */
    gap: 20px;
    margin-bottom: 25px;
}

.stock-inputs .form-group {
    width: calc(50% - 10px);
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Align elements properly */
}

.stock-inputs .form-group label {
    margin-bottom: 8px;
    order: 1;
}

.stock-inputs .form-group select,
.stock-inputs .form-group input[type="text"] {
    width: 100%;
    max-width: 450px;
    padding: 12px; /* Uniform padding */
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    line-height: 1.5;
    order: 2;
    box-sizing: border-box; /* Include padding in calculations */
    flex: 1; /* Fill available space */
}

@media (max-width: 768px) {
    .stock-inputs {
        flex-direction: column;
    }
    
    .stock-inputs .form-group {
        width: 100%;
        margin-bottom: 15px;
    }
}

.stock-inputs .form-group {
    width: calc(50% - 10px); /* Adjust width with spacing */
}

/* Ensure input elements don't overlap */
.stock-inputs input[type="text"],
.stock-inputs select {
    max-width: 100%; /* Prevent overflow */
    box-sizing: border-box; /* Include padding in width calculation */
}

@media (max-width: 768px) {
    .stock-inputs {
        flex-direction: column;
    }
    
    .stock-inputs .form-group {
        width: 100%;
        margin-bottom: 15px;
    }
}

fieldset.analyst-selection {
    margin-top: 20px;
    padding: 0;
    border: none;
}

.checkbox-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 15px;
}

@media (max-width: 768px) {
    .stock-inputs,
    fieldset.analyst-selection {
        margin-left: 0;
    }
    
    .stock-inputs {
        flex-direction: column;
    }
    
    .stock-inputs .form-group {
        width: 100%;
        margin-bottom: 15px;
    }
}

@media (max-width: 768px) {
    .stock-inputs {
        flex-direction: column;
    }
    
    .stock-inputs .form-group {
        width: 100%;
        margin-bottom: 15px;
    }
}

/* Enhanced label styles for better readability */
.stock-inputs label,
fieldset.analyst-selection legend {
    display: block !important;
    margin-bottom: 12px !important; /* Improved spacing */
    font-size: 18px !important; /* Larger font size */
    font-weight: 600 !important;
    color: #333 !important;
    line-height: 1.4 !important;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

/* Adjusted input field appearance to match larger labels */
.stock-inputs input[type="text"],
.stock-inputs select {
    width: 100%;
    padding: 12px; /* Increased padding */
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 18px; /* Match label size */
    line-height: 1.4;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .stock-inputs input[type="text"],
    .stock-inputs select {
        font-size: 16px; /* Slightly smaller on mobile */
        padding: 10px;
    }
    
    .stock-inputs label,
    fieldset.analyst-selection legend {
        font-size: 16px !important; /* Responsive font size */
    }
}

.form-group {
    display: flex;
    flex-direction: column;
}

label {
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
}

input[type="text"],
select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
}

.form-actions {
    margin-top: 20px;
    margin-left: 260px;
}

@media (max-width: 992px) {
    .form-grid,
    .form-actions {
        margin-left: 0;
    }
}

label {
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
}

input[type="text"],
select {
    width: 100%;
    max-width: 450px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
}

.form-actions {
    margin-top: 20px;
    margin-left: 260px;
}

@media (max-width: 992px) {
    .form-container,
    .form-actions {
        margin-left: 0;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .form-group {
        margin-right: 0;
    }
}

.form-group {
    max-width: 450px !important;
    flex: 1 !important;
}

label {
    display: block !important;
    margin-bottom: 8px !important;
    font-weight: 600 !important;
    color: #555 !important;
    line-height: 1.4 !important;
}

@media (max-width: 992px) {
    .form-row {
        margin-left: 0 !important;
    }
}

.form-row .form-group:first-child {
    margin-left: -260px !important;
    position: relative !important;
    left: 260px !important;
}

.form-group {
    flex: 1 !important;
    max-width: 450px !important;
    margin-right: 20px !important;
}

.form-group:last-child {
    margin-right: 0 !important;
}

@media (max-width: 768px) {
    .form-row {
        flex-direction: column !important;
    }
}

input[type="text"],
select {
    width: 100% !important;
    max-width: 450px !important;
    padding: 12px !important;
    border: 1px solid #ddd !important;
    border-radius: 6px !important;
    font-size: 16px !important;
    transition: border-color 0.3s !important;
}

input[type="text"]:focus,
select:focus {
    border-color: #007bff !important;
    outline: none !important;
    box-shadow: 0 0 4px rgba(0,123,255,0.25) !important;
}

/* Optimized analyst selection spacing */
fieldset.analyst-selection {
    border: none;
    padding: 0;
    margin-top: 20px;
    margin-bottom: 10px; /* Reduced spacing */
}

fieldset.analyst-selection legend {
    font-size: 14px; /* Match other labels */
    font-weight: 600;
    margin-bottom: 12px; /* Tightened spacing */
    color: #333;
}

.checkbox-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

/* Perfect checkbox alignment */
.checkbox {
    display: flex;
    align-items: flex-start; /* Align to top */
    gap: 8px; /* Consistent spacing */
    margin-bottom: 12px;
}

/* Precise checkbox alignment */
.checkbox {
    display: flex;
    align-items: baseline; /* Align to text baseline */
    gap: 8px;
    margin-bottom: 12px;
}

.checkbox input[type="checkbox"] {
    margin: 0;
    position: relative; /* Enable fine-tuning */
    top: 1px; /* Exact vertical adjustment */
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-right: 8px;
}

.checkbox label {
    font-size: 16px;
    line-height: 1.2;
    margin: 0;
    color: #333;
    font-weight: 500;
    padding: 0; /* Remove previous adjustment */
}

.analysis-btn {
    background: #007bff !important;
    color: white !important;
    padding: 12px 25px !important;
    border: none !important;
    border-radius: 6px !important;
    font-size: 16px !important;
    cursor: pointer !important;
    transition: background 0.3s !important;
    margin-top: 20px !important;
    margin-left: 260px !important;
}

@media (max-width: 992px) {
    .analysis-btn {
        margin-left: 0 !important;
    }
}

.analysis-btn:hover {
    background: #0056b3 !important;
}

.analysis-results {
    margin: 30px 0 0 260px !important;
    padding: 25px !important;
    background: #ffffff !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
    min-width: 300px !important;
}

@media (max-width: 992px) {
    .analysis-results {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

.system-messages {
    margin-top: 20px;
    padding: 15px;
    background: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 4px;
    color: #856404;
    font-size: 14px;
}

.analyst-box {
    border: 1px solid #ddd;
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 8px;
    background-color: #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

@media (max-width: 768px) {
    .dashboard-container {
        padding: 20px;
    }
    
    input[type="text"],
    select {
        max-width: 100%;
    }
}

.alert {  
    color: red;  
    margin-top: 20px;  
    padding: 10px;  
    background: #fff3f3;  
    border-radius: 4px;  
}
